package com.yc.demo.servlet.login;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/chooseBn.s")
public class ChooseBnServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		   String[] bns = {"chitose","haruto","hibiki","hijiki","izumi","koharu","miku","ni-j","nico","nipsilon","nito","shizuku","tororo","tsumiki","unitychan","wanko","z16"};
		   response.setContentType("text/html;charset=utf-8");
		   response.getWriter().append("选择伴娘：");
		   response.getWriter().append("<form id='f' action='setBn.s'>");
		   response.getWriter().append("<select name='bn' onchange='f.submit()'>");
		   for(String bn : bns) {
			   response.getWriter().append("<option value='"+bn+"'>"+bn+"</option>");
		   }
		   response.getWriter().append("</select>");
		   response.getWriter().append("</form>");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
